using System;
using System.Text;
using System.Reflection;
using System.ServiceModel;
using System.Collections.Generic;
using System.Runtime.Serialization;
using TDS = Tridion.ContentManager.Interop.TDS;
using TDSDefines = Tridion.ContentManager.Interop.TDSDefines;



#pragma warning disable 649
namespace Tridion.Gateway
{
	[DataContract]
	public class Component:Facade
	{
        internal Component(TDS.Component Component, bool ShallowCopy)
            : base(typeof(TDS._Component), Component, ShallowCopy)
		{
		}

		[DataMember(Name="ItemType")]
		private TDSDefines.ItemType itemtype;
		public TDSDefines.ItemType ItemType
		{
			 get { return itemtype; }
		}


		[DataMember(Name="ID")]
		private String id;
		public String ID
		{
			 get { return id; }
		}


		[DataMember(Name="Info")]
		private Info info;
		public Info Info
		{
			 get { return info; }
		}


		[DataMember(Name="Title")]
		private String title;
		public String Title
		{
			 get { return title; }
			 set { title = value; }
		}


        //TODO:Fix
        //[DataMember(Name="OrganizationalItem")]
        //private Object organizationalitem;
        //public Object OrganizationalItem
        //{
        //     get { return organizationalitem; }
        //}


		[DataMember(Name="isEditable")]
		private Boolean iseditable;
		public Boolean isEditable
		{
			 get { return iseditable; }
		}


		[DataMember(Name="Fields")]
		private ItemField[] fields;
		public ItemField[] Fields
		{
			 get { return fields; }
		}


		[DataMember(Name="MetadataFields")]
		private ItemField[] metadatafields;
		public ItemField[] MetadataFields
		{
			 get { return metadatafields; }
		}


		[DataMember(Name="IsInCircularComponentLink")]
		private Boolean isincircularcomponentlink;
		public Boolean IsInCircularComponentLink
		{
			 get { return isincircularcomponentlink; }
		}


		[DataMember(Name="CircularComponentLinkLevel")]
		private Int32 circularcomponentlinklevel;
		public Int32 CircularComponentLinkLevel
		{
			 get { return circularcomponentlinklevel; }
		}


		[DataMember(Name="ApprovalStatus")]
		private ApprovalStatus approvalstatus;
		public ApprovalStatus ApprovalStatus
		{
			 get { return approvalstatus; }
			 set { approvalstatus = value; }
		}

        
        //TODO:Fix
        [DataMember(Name = "Multimedia")]
        [IgnoreReflectedField()]
        private Multimedia multimedia;
        public Multimedia Multimedia
        {
            get { return multimedia; }
        }


		[DataMember(Name="Publication")]
		private Publication publication;
		public Publication Publication
		{
			 get { return publication; }
		}


		[DataMember(Name="Schema")]
		private Schema schema;
		public Schema Schema
		{
			 get { return schema; }
			 set { schema = value; }
		}


		[DataMember(Name="IsBasedOnTridionWebSchema")]
		private Boolean isbasedontridionwebschema;
		public Boolean IsBasedOnTridionWebSchema
		{
			 get { return isbasedontridionwebschema; }
		}


		[DataMember(Name="IsMultimediaComponent")]
		private Boolean ismultimediacomponent;
		public Boolean IsMultimediaComponent
		{
			 get { return ismultimediacomponent; }
		}



        protected override void Initialize(FieldInfo field, PropertyInfo property, Object value)
        {
            switch (field.Name)
            {
                case "Multimedia":
                    if (ismultimediacomponent)
                    {
                        object o = property.GetValue(value, null); 
                        multimedia = new Multimedia(o as TDS.Multimedia, true);
                    }
                    break;
            }

        }
	}
}

/*
			System.String Render(System.Object, System.String)
			System.String GetXML(Tridion.ContentManager.Interop.TDSDefines.XMLReadFilter)
			Void UpdateXML(System.String)
			Void Save(Boolean)
			Void Delete()
			Void Localize()
			Void UnLocalize()
			System.String GetVersionList(Tridion.ContentManager.Interop.TDSDefines.ListColumnFilter)
			Void CheckIn(Boolean)
			Void CheckOut(Boolean)
			Void UndoCheckOut(Boolean)
			Void RollBack(Int32, Boolean)
			System.String GetRollBackComment(Int32)
			Void DeleteVersion(Int32)
			System.String GetListKeywords(Tridion.ContentManager.Interop.TDSDefines.ListColumnFilter)
			Tridion.ContentManager.Interop.TDS.Keywords GetKeywords()
			Tridion.ContentManager.Interop.TDS.Component GetLinkedComponent(System.Object)
			System.String Publish(System.Object, Boolean, Boolean, Boolean, System.DateTime, System.DateTime, System.DateTime, Boolean, Tridion.ContentManager.Interop.TDSDefines.EnumPublishPriority, Boolean, Int32)
			System.String UnPublish(System.Object, Boolean, Boolean, Boolean, System.DateTime, Boolean, Tridion.ContentManager.Interop.TDSDefines.EnumPublishPriority)
			System.String GetListPublishItems(System.Object, Boolean, Boolean, Tridion.ContentManager.Interop.TDSDefines.ListColumnFilter, Tridion.ContentManager.Interop.TDS.ListRowFilter)
*/
